namespace SampleApp.Tests {
    using Microsoft.Services.TestTools.UITesting.Html;
    using Microsoft.VisualStudio.TestTools.UITesting;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    using SampleApp.Tests.Pages;

    [CodedUITest]
    public class CategoriesTests : PageTest<Categories> {
        
        [TestMethod]
        public void NewCategoryShowsUpInCategoriesList() {

            string categoryName = Name();

            bool exists = TestedPage
                .NavigateToCreateCategory()
                .CreateNewCategory(categoryName)
                .CategoryExistsInList(categoryName);

            Assert.IsTrue(exists, "The newly created category doesn't exist in the categories list");
        }
    }
}